package com.mxpio.erp.common.mes.entity;

import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Data
@Table(name="MB_ERP_MES_WORKORDER_TASK_SPLIT")
@EqualsAndHashCode(callSuper=false)
@Entity
@Schema(description="生产订单-工单-工序任务分批报工")
@AllArgsConstructor
@NoArgsConstructor
public class ManufactureWorkOrderTaskSplit extends BaseEntity {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@Id
    @Column(name = "id")
    @Generator(policy = UUIDPolicy.class)
    @Schema(description = "id")
    private String id;

    @Column(name = "TASK_CODE_")
    @Schema(description = "工单任务编号")
    private String taskCode;//String taskCode = "T"+batchTecInfo.getBatchInfoCode()+tecInfo.getProcOrder();//之前的取值逻辑

    /**生产订单主键*/
    @Column(name = "BIZ_NO_")
    @Schema(description = "生产订单单号")
    private String bizNo;

    /**批次号*/
    @Column(name = "BATCH_CODE_")
    @Schema(description = "批次号")
    private String batchCode;

    /**工序编号*/
    @Schema(description = "工序编号")
    @Column(name = "PROC_CODE_")
    private String procCode;
    /**工序序号*/
    @Schema(description = "工序序号")
    @Column(name = "PROC_ORDER_")
    private Integer procOrder;

    @Column(name = "TASK_NUM_")
    @Schema(description = "数量")
    private Integer taskNum;//任务数量

    @Column(name = "SPLIT_TASK_NUM_")
    @Schema(description = "分批报工数量")
    private Integer splitTaskNum;

    public ManufactureWorkOrderTaskSplit(ManufactureWorkOrderTask task){
        this.taskCode=task.getTaskCode();
        this.bizNo=task.getBizNo();
        this.batchCode=task.getBatchCode();
        this.procCode=task.getProcCode();
        this.procOrder=task.getProcOrder();
        this.taskNum=task.getTaskNum();
    }
}
